<template>
    <page-layout :avatar="currUser.avatar">
        <div slot="headerContent">
            <div class="title">欢迎，{{specialist.specialist_realname}}！，职称：{{specialist.professional_title}} 电话：{{specialist.specialist_contact}}</div>
            <div>XX方向建筑专家</div>
        </div>
        <template slot="extra">
            <head-info class="split-right" :title="$t('project')" content="56"/>
            <head-info class="split-right" :title="$t('visit')" content="2,223"/>
        </template>
        <template>
            <a-row style="margin: 0 -12px">
                <a-card class="project-list" :loading="loading" style="margin-bottom: 24px;" :bordered="false"
                        :title="$t('all')" :body-style="{padding: 0}">
                    <a slot="extra">{{$t('progress')}}</a>
                    <div>

                        <a-card-grid :key="i" v-for="(item, i) in projects">
                            <a-card :bordered="false" :body-style="{padding: 0}"
                                    @click="goProjectReview(item.review_id)">
                                <a-card-meta :description="item.review_tip">
                                    <div slot="title" class="card-title">
                                        <a-avatar size="small" :src='logo'/>
                                        <span>{{item.review_name}}</span>
                                    </div>
                                </a-card-meta>
                                <div class="project-item">
                                    <a class="group" href="/#/list/project-review">查看详情</a>
                                    <span class="datetime">9小时前</span>
                                </div>
                            </a-card>
                        </a-card-grid>

                    </div>
                </a-card>
                <a-card :loading="loading" :title="$t('dynamic')" :bordered="false">
                    <a-list>
                        <a-list-item :key="index" v-for="(item, index) in activities">
                            <a-list-item-meta>
                                <a-avatar slot="avatar" :src="item.avatar"/>
                                <div slot="title" v-html="item.template"/>
                                <div slot="description">{{item.time}}</div>
                            </a-list-item-meta>
                        </a-list-item>
                    </a-list>
                </a-card>
            </a-row>
        </template>
    </page-layout>
</template>

<script>
    import PageLayout from '@/layouts/PageLayout'
    import HeadInfo from '@/components/tool/HeadInfo'
    import {mapState} from 'vuex'
    import Axios from "axios"
    //import {request, METHOD} from '@/utils/request'

    export default {
        name: 'WorkPlace',
        components: {HeadInfo, PageLayout},
        i18n: require('./i18n'),
        data() {
            return {
                id: this.$route.params.id,
                specialist: this.$store.state.specialist,
                url: this.$store.state.apiUrl + ':' + this.$store.state.apiPort,
                projects: [],
                loading: true,
                activities: [],
                teams: [],
                logo: "https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png",
                welcome: {
                    timeFix: '',
                    message: ''
                }
            }
        },
        computed: {
            ...mapState('account', {currUser: 'user'}),
            ...mapState('setting', ['lang'])
        },
        created() {
            this.activities.push(
                {
                    index:1,
                    avatar:"https://gw.alipayobjects.com/zos/rmsportal/cnrhVkzwxjPwAaCfPbdc.png",
                    template:"银色战车 使用了 <a >绿宝石水花</a>",
                    time:"9小时前"
                },{
                    index:2,
                    avatar:"https://gw.alipayobjects.com/zos/rmsportal/cnrhVkzwxjPwAaCfPbdc.png",
                    template:"白金之星 痛击了<a >杀手皇后</a>",
                    time:"9小时前"
                }
            )

            Axios.post(this.url + "/pxManagerSystem/getReviewGroupInfoBySpecialistId", {
                specialist_id: this.specialist.specialist_id
            }).then(
                res => {
                    console.log(res.data.data.reviewGroupInfoList)
                    this.projects = res.data.data.reviewGroupInfoList;
                    this.loading = false
                    console.log(this.projects)
                }
            )
        },
        methods: {
            goProjectReview(id) {
                console.log(id)
                this.$store.state.reviewG_id = id
                this.$router.push({
                    name: '评审组所评审项目',
                })
            }
        }
    }
</script>

<style lang="less">
    @import "index";
</style>
